package com.beten.ui.launch;

import android.content.Context;
import android.view.View;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.TextView;

import com.beten.demo.R;
import com.beten.ui.util.BtAdapter;

public class LaunchNewsAdapter extends BtAdapter<LaunchNewsInfo,LaunchItemHolder> {

	public LaunchNewsAdapter(Context context) {
		super(context);
	}

	@Override
	protected LaunchItemHolder getNewHolder(int position, View convertView,
			LaunchNewsInfo info) {
		LaunchItemHolder  holder = new LaunchItemHolder();   
        holder.icon = (ImageView) convertView.findViewById(R.id.icon);   
        holder.text = (TextView) convertView.findViewById(R.id.text);  
        return holder;
        
	}

	@Override
	protected View getNewView(int position, LaunchNewsInfo info) {
		View convertView;
		convertView = mInflater.inflate(R.layout.launch_item, null); 

		convertView.setLayoutParams(new Gallery.LayoutParams(
				Gallery.LayoutParams.FILL_PARENT,
				Gallery.LayoutParams.FILL_PARENT));
		
		
		return convertView;
	}

	@Override
	protected void fillHolder(int position, View convertView,
			LaunchItemHolder holder,LaunchNewsInfo info) {
		 
		holder.icon.setImageResource(R.drawable.icon);   
		holder.text.setText(info.txt);  
		
	}
	
	@Override
	protected String getInfoType(LaunchNewsInfo info) {
		return defautGetInfoType(info);
	}
}
